<template>
	<view class="agreement">
		<view class="cont">
			<rich-text :nodes="agreementText"></rich-text> 
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				agreementText:'',
				id:''
			};
		},
		onLoad(opt) {
			if(opt.type){
				this.id=opt.type
				let itemStr='协议详情'
			
				if(opt.type=='user'){
					itemStr='服务协议'
				}
				if(opt.type=='privacy'){
					itemStr='隐私协议'
				}
				if(opt.type=='tripartite'){
					itemStr='第三方协议'
				}
				// console.log(itemStr);
				uni.setNavigationBarTitle({
					title: itemStr
				});
				this.getProtocolDetail()
				
			}
		},
		methods:{
			//获取协议列表
			getProtocolDetail(){
				let that = this;
				this.$api.getAgreement({type:this.id}).then(res=>{
					console.log(res);
					if(res.content&&res.title){
						uni.setNavigationBarTitle({
							title: res.title
						});
						that.agreementText = res.content;
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.agreement{
		padding: 30rpx;
		.cont{
			background: #FFFFFF;
			border-radius: 20rpx 20rpx 20rpx 20rpx;
			padding-top: 70rpx;
			padding-left: 30rpx;
			padding-right: 30rpx;
			padding-bottom: 58rpx;
		}
	}

</style>
